package leetcode.code0365;

public class Solution1 extends Solution365 {


	@Override
	public boolean canMeasureWater(int jug1Capacity, int jug2Capacity, int targetCapacity) {
//		if (targetCapacity > jug1Capacity + jug2Capacity)// 不可能超出最大
//			return false;
//		if (targetCapacity == jug1Capacity + jug2Capacity)// 装满相等后续讨论不到
//			return true;
		return targetCapacity % gcd(jug1Capacity, jug2Capacity) == 0;
	}

	private int gcd(int a, int b) {
		return b == 0 ? a : gcd(b, a % b);
	}

	public static void main(String[] args) {
		Solution1 so = new Solution1();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();
	}

}
